﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SL.Loader
{
    public partial class AppLoader : UserControl, ISilverlightLoader
    {
        public AppLoader()
        {
            InitializeComponent();
        }

        public void initCallback(List<Uri> packageSourceList)
        {

        }

        public void downloadStartCallback(Uri packageSource)
        {

            lblLoadingInfomation.Text = "Start Loading " + System.IO.Path.GetFileName(packageSource.LocalPath) + ".";
        }

        public void downloadProgressCallback(Uri packageSource, DownloadProgressEventArgs eventArgs)
        {
            lblLoadingInfomation.Text = "Loading " + System.IO.Path.GetFileName(packageSource.LocalPath) + " (" + eventArgs.ProgressPercentage.ToString() + "%).";
        }

        public void downloadCompleteCallback(Uri packageSource, DownloadCompleteEventArgs eventArgs)
        {
            XapUtil.setCurrentXapFile(packageSource);
        }

        public void SetTitle(string title)
        {
            lblSystemTitle.Text = title;
        }
    }
}
